package com.community.process._1010.dao.view;

import com.baomidou.mybatisplus.annotation.TableName;
import com.community.process._1010.common.base.BaseEntity;
import com.community.process._1010.common.utils.SystemAmountUtil;
import com.community.process._1010.dao.entity.ProcessFoodItem;
import com.community.process._1010.dao.entity.ProcessIngredients;
import com.community.process._1010.dao.entity.ProcessOrderItem;
import com.community.process._1010.domains.ProcessOrderDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * 到餐加工子订单商品列表
 *
 * @author Zbs
 * @since 2024-09-05
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Schema(description = "到餐加工子订单商品列表")
public class ProcessOrderItemView extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    @Schema(description = "子订单ID")
    private Long orderId;

    @Schema(description = "商品ID")
    private Long itemId;

    @Schema(description = "商品类型 1 自带食材 2 成品菜 3 自组食材")
    private Integer type;

    @Schema(description = "商品名称")
    private String itemName;

    @Schema(description = "商品数量")
    private Integer itemNum;

    @Schema(description = "商品单价")
    private BigDecimal itemPrice;

    @Schema(description = "商品总价")
    private BigDecimal totalPrice;

    @Schema(description = "单位")
    private String units;

    @Schema(description = "单位数量")
    private Integer unitsNum;

    @Schema(description = "图片")
    private String image;

    public ProcessOrderItemView(ProcessOrderItem item) {
        this.itemId = item.getItemId();
        this.type = item.getType();
        this.itemName = item.getItemName();
        this.itemNum = item.getItemNum();
        this.units = item.getUnits();
        this.image = item.getImage();
        this.unitsNum = item.getUnitsNum();
        this.itemPrice = SystemAmountUtil.pennyToYuan(item.getItemPrice());
        this.totalPrice = SystemAmountUtil.pennyToYuan(item.getTotalPrice());
    }

}
